<!-- app/Views/travel/index.php -->

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title><?= esc($title) ?></title>
    <!-- 引入Bootstrap CSS -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    <style>
        .card {
            transition: transform 0.2s;
        }
        .card:hover {
            transform: scale(1.05);
        }
        .btn-custom {
            background-color: #007bff;
            border-color: #007bff;
        }
        .btn-custom:hover {
            background-color: #0056b3;
            border-color: #0049a0;
        }
    </style>
</head>
<body>
<div class="container mt-5">
    <h1 class="mb-4"><?= esc($heading) ?></h1>

    <?php if (!empty($records)): ?>
        <div class="row row-cols-1 row-cols-md-3 g-4">
            <?php foreach ($records as $record): ?>
                <div class="col">
                    <div class="card h-100 shadow-sm">
                        <?php if (!empty($record->image)): ?>
                            <img src="/image/<?= esc($record->image) ?>" class="card-img-top" alt="<?= esc($record->name) ?>">
                        <?php else: ?>
                            <img src="https://via.placeholder.com/300x200" class="card-img-top" alt="Placeholder Image">
                        <?php endif; ?>
                        <div class="card-body d-flex flex-column">
                            <h5 class="card-title"><?= esc($record->name) ?></h5>
                            <p class="card-text flex-grow-1"><?= esc($record->city) ?></p>
                            <div class="mt-auto">
                                <?= anchor("hockey/showme/{$record->id}", 'Learn More', ['class' => 'btn btn-custom']) ?>
                            </div>
                        </div>
                    </div>
                </div>
            <?php endforeach; ?>
        </div>
    <?php else: ?>
        <p>No travel destinations found.</p>
    <?php endif; ?>

    <footer class="mt-5 text-center">
        <p><?= esc($footer) ?></p>
    </footer>
</div>

<!-- 引入Bootstrap JS Bundle (包含Popper) -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>